WriteToFile Method (Attachment Object) 

The WriteToFile method saves the attachment to a file in the file system. Note that if the file already exists, this method overwrites it without warning.

Syntax

objAttachment.WriteToFile(file name)

Parameters

objAttachment

Required. The Attachment object.

file name

Required. String. The full path and file name for the saved attachment. For example, C:\DOCUMENT\BUDGET.XLS.

 

Remarks

The WriteToFile method overwrites the file without warning if a file of that name already exists. Your application should check for the existence of the file before calling WriteToFile.

The WriteToFile method operates differently, depending on the value of the Attachment object s TypeENNF7U property. The following table describes its operation:

Attachment Type property

WriteToFile operation

mapiFileData

Copies the contents of the specified file to the attachment.

mapiFileLink

(Not supported)

mapiOLE

Writes the file as an OLE docfile format.

mapiEmbeddedMessage

(Not supported)

 

WriteToFile does not support mapiFileLink or mapiEmbeddedMessage attachments.

See Also

ReadFromFile Method (Attachment Object)7TMO9S